package club.beimeng.demos.de2021年4月20日;


import java.io.*;
import java.lang.*;
class Three {
    public static void main(String[] args) throws Exception {
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.valueOf(buf.readLine());
        String[] strNums = buf.readLine().split(" ");
        int[] nums = new int[n];
        for (int i = 0; i < n; ++i) {
            nums[i] = Integer.valueOf(strNums[i]);
        }
        for (int num : nums) {
            int cnt = 0;
            while (num != 0) {
                if ((num & 1) == 1) cnt++;
                num >>= 1;
            }
            System.out.printf("%d ", cnt);
        }
    }

}



/*
 *
 * @author Mr.Bao
 * @date
 */